package org.micro.rbac.core.model;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.micro.rbac.dao.entity.SysRole;

import java.io.Serial;
import java.util.List;

/**
 * 登录用户
 *
 * @author hongsir
 * @since 2024/6/12
 **/
@Setter
@Getter
@Accessors(chain = true)
public class SessionUser extends BaseBean {
    @Serial
    private static final long serialVersionUID = 1038311201488118588L;
    @Schema(description = "令牌")
    private String token;
    @Schema(description = "用户ID")
    private Long userId;
    @Schema(description = "登录名")
    private String loginName;
    @Schema(description = "用户名")
    private String userName;
    @Schema(description = "超管标识:1-是,0-否")
    private Integer superFlag;
    @Schema(description = "当前用户的角色信息")
    private List<SysRole> roleList;
    /**
     * 是否超管
     *
     * @return
     */
    private boolean isSuper() {
        return this.superFlag == 1;
    }

}
